

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>对象操作 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/doctools.js"></script>
        <script src="../../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="Temp URL 操作" href="../tempurl/" />
    <link rel="prev" title="Container Operations" href="../containerops/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../../">Ceph 对象网关</a></li>
          <li class="breadcrumb-item"><a href="../">Ceph 对象网关 Swift API</a></li>
      <li class="breadcrumb-item active">对象操作</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../../_sources/radosgw/swift/objectops.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">Ceph 对象网关</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../frontends/">HTTP 前端</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../multisite/">多站配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../zone-features/">域的功能</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../placement/">存储池归置与存储类</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../multisite-sync-policy/">多站同步策略配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../pools/">存储池的配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../config-ref/">配置参考</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/">管理指南</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../account/">用户账户</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../s3/">S3 API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../iam/">IAM API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../rgw-cache/">数据缓存和 CDN</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../">Swift API</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="../#api">API</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="../auth/">认证</a></li>
<li class="toctree-l4"><a class="reference internal" href="../serviceops/">服务操作</a></li>
<li class="toctree-l4"><a class="reference internal" href="../containerops/">容器操作</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">对象操作</a></li>
<li class="toctree-l4"><a class="reference internal" href="../tempurl/">临时 URL 操作</a></li>
<li class="toctree-l4"><a class="reference internal" href="../tutorial/">指导手册</a></li>
<li class="toctree-l4"><a class="reference internal" href="../java/">Java</a></li>
<li class="toctree-l4"><a class="reference internal" href="../python/">Python</a></li>
<li class="toctree-l4"><a class="reference internal" href="../ruby/">Ruby</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../#id1">功能支持</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../adminops/">管理操作 API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../api/">Python 接口</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../nfs/">通过 NFS 导出</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../keystone/">与 OpenStack Keystone 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../barbican/">与 OpenStack Barbican 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../vault/">与 HashiCorp Vault 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../kmip/">与 KMIP 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../opa/">与 Open Policy Agent 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../multitenancy/">多租户</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../compression/">压缩</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../ldap-auth/">LDAP 认证</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../encryption/">服务器端加密</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../bucketpolicy/">桶策略</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../dynamicresharding/">动态的桶索引重分片</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../mfa/">多因子认证</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../sync-modules/">同步模块</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../notifications/">Bucket Notifications</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../layout/">RADOS 中的数据布局</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../STS/">STS</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../STSLite/">STS Lite</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../keycloak/">Keycloak</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../session-tags/">Session Tags</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../role/">Role</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../orphans/">Orphan List and Associated Tooliing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../oidc/">OpenID Connect Provider</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../troubleshooting/">故障排除</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../man/8/radosgw/">radosgw 手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../man/8/radosgw-admin/">radosgw-admin 手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../qat-accel/">使用 QAT 为加密和压缩提速</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../s3select/">S3-select</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../lua-scripting/">Lua Scripting</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../d3n_datacache/">D3N Data Cache</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../cloud-transition/">Cloud Transition</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../metrics/">Metrics</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../uadk-accel/">UADK Acceleration for Compression</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../bucket_logging/">桶的日志记录</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="id1">
<h1>对象操作<a class="headerlink" href="#id1" title="Permalink to this heading"></a></h1>
<p>对象是个用于存储数据和元数据的容器。容器可以包含很多对象，但是对象的名字必须唯一。这个 API 允许客户端创建对象、设置访问权限及元数据、读取对象的数据和元数据、以及删除对象。因为此 API 发出的请求是与用户帐户信息相关的，所以此 API 内的所有请求都必须认证，除非容器或对象的访问控制权限被故意设置成了可公开访问（即允许匿名请求）。</p>
<section id="id2">
<h2>创建或更新对象<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h2>
<p>要创建新对象，需发送带有 API 版本、帐户、容器名和新对象名的 <code class="docutils literal notranslate"><span class="pre">PUT</span></code> 请求。还必须有对应容器的写权限才能创建或更新对象。容器内的对象名字必须唯一。 <code class="docutils literal notranslate"><span class="pre">PUT</span></code> 请求不会预先检测，所以你要是没用唯一的名字，此请求就会更新对象。然而你可以在对象名中用伪分级语法来区分同名、但位于不同伪分级目录的对象。你可以在请求头里加上访问控制和元数据头。</p>
<section id="id3">
<h3>语法<a class="headerlink" href="#id3" title="Permalink to this heading"></a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">PUT</span> <span class="o">/</span><span class="p">{</span><span class="n">api</span> <span class="n">version</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">account</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">container</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="nb">object</span><span class="p">}</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span>
<span class="n">Host</span><span class="p">:</span> <span class="p">{</span><span class="n">fqdn</span><span class="p">}</span>
<span class="n">X</span><span class="o">-</span><span class="n">Auth</span><span class="o">-</span><span class="n">Token</span><span class="p">:</span> <span class="p">{</span><span class="n">auth</span><span class="o">-</span><span class="n">token</span><span class="p">}</span>
</pre></div>
</div>
</section>
<section id="id4">
<h3>请求头<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">ETag</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>对象内容的 MD5 哈希值，建议设置。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>字符串</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>否</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">Content-Type</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>对象所包含内容的类型。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>字符串</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>否</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">Transfer-Encoding</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>用于标识此对象是否是更大的聚合对象的一部分。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>字符串</p>
</dd>
<dt class="field-odd">有效取值<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">chunked</span></code></p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>否</p>
</dd>
</dl>
</section>
</section>
<section id="id5">
<h2>复制对象<a class="headerlink" href="#id5" title="Permalink to this heading"></a></h2>
<p>对象复制方法允许你在服务器端创建对象副本，这样你就不必先下载、再上传到另一个容器或名字了。要把一对象的内容复制到另一对象，你可以发送 <code class="docutils literal notranslate"><span class="pre">PUT</span></code> 请求或 <code class="docutils literal notranslate"><span class="pre">COPY</span></code> 请求，要携带 API 版本、帐户、和容器名。发送 <code class="docutils literal notranslate"><span class="pre">PUT</span></code> 请求时，请求内容为目标容器和对象名，源容器和对象在请求头里设置；对于 <code class="docutils literal notranslate"><span class="pre">COPY</span></code> 请求，请求内容为源容器和对象，目标容器和对象在请求头里。要复制对象，你必须有写权限；目标对象名在其容器内也必须唯一。此请求不会预先检查，所以如果名字不唯一，它就会更新目标对象。然而你可以在对象名中用伪分级语法来区分同名、但位于不同伪分级目录的对象。你可以在请求头里加上访问控制和元数据头。</p>
<section id="id6">
<h3>语法<a class="headerlink" href="#id6" title="Permalink to this heading"></a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">PUT</span> <span class="o">/</span><span class="p">{</span><span class="n">api</span> <span class="n">version</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">account</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">dest</span><span class="o">-</span><span class="n">container</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">dest</span><span class="o">-</span><span class="nb">object</span><span class="p">}</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span>
<span class="n">X</span><span class="o">-</span><span class="n">Copy</span><span class="o">-</span><span class="n">From</span><span class="p">:</span> <span class="p">{</span><span class="n">source</span><span class="o">-</span><span class="n">container</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">source</span><span class="o">-</span><span class="nb">object</span><span class="p">}</span>
<span class="n">Host</span><span class="p">:</span> <span class="p">{</span><span class="n">fqdn</span><span class="p">}</span>
<span class="n">X</span><span class="o">-</span><span class="n">Auth</span><span class="o">-</span><span class="n">Token</span><span class="p">:</span> <span class="p">{</span><span class="n">auth</span><span class="o">-</span><span class="n">token</span><span class="p">}</span>
</pre></div>
</div>
<p>或者这样：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">COPY</span> <span class="o">/</span><span class="p">{</span><span class="n">api</span> <span class="n">version</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">account</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">source</span><span class="o">-</span><span class="n">container</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">source</span><span class="o">-</span><span class="nb">object</span><span class="p">}</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span>
<span class="n">Destination</span><span class="p">:</span> <span class="p">{</span><span class="n">dest</span><span class="o">-</span><span class="n">container</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">dest</span><span class="o">-</span><span class="nb">object</span><span class="p">}</span>
</pre></div>
</div>
</section>
<section id="id7">
<h3>请求头<a class="headerlink" href="#id7" title="Permalink to this heading"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">X-Copy-From</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>用于在 <code class="docutils literal notranslate"><span class="pre">PUT</span></code> 请求中定义源容器或对象的路径。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>字符串</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>用 <code class="docutils literal notranslate"><span class="pre">PUT</span></code> 方法时必需</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">Destination</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>用于在 <code class="docutils literal notranslate"><span class="pre">COPY</span></code> 请求中定义目标容器或对象的路径。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>字符串</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>用 <code class="docutils literal notranslate"><span class="pre">COPY</span></code> 方法时必需</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">If-Modified-Since</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>如果从源对象的 <code class="docutils literal notranslate"><span class="pre">last_modified</span></code> 属性记录的时间起修改过，那就复制。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>日期</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>否</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">If-Unmodified-Since</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>如果从源对象的 <code class="docutils literal notranslate"><span class="pre">last_modified</span></code> 属性记录的时间起没有修改过，那就复制。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>日期</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>否</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">Copy-If-Match</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>请求中的 ETag 与源对象的 ETag 属性相同时才复制。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>ETag.</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>否</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">Copy-If-None-Match</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>请求中的 ETag 与源对象的 ETag 属性不同时才复制。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>ETag.</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>否</p>
</dd>
</dl>
</section>
</section>
<section id="id8">
<h2>删除对象<a class="headerlink" href="#id8" title="Permalink to this heading"></a></h2>
<p>要删除对象，可发送带有 API 版本、帐户、容器和对象名的 <code class="docutils literal notranslate"><span class="pre">DELETE</span></code> 请求。此帐户必须有容器的写权限，才能删除其内的对象。成功删除对象后，你就能重用对象名了。</p>
<section id="id9">
<h3>语法<a class="headerlink" href="#id9" title="Permalink to this heading"></a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">DELETE</span> <span class="o">/</span><span class="p">{</span><span class="n">api</span> <span class="n">version</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">account</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">container</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="nb">object</span><span class="p">}</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span>
<span class="n">Host</span><span class="p">:</span> <span class="p">{</span><span class="n">fqdn</span><span class="p">}</span>
<span class="n">X</span><span class="o">-</span><span class="n">Auth</span><span class="o">-</span><span class="n">Token</span><span class="p">:</span> <span class="p">{</span><span class="n">auth</span><span class="o">-</span><span class="n">token</span><span class="p">}</span>
</pre></div>
</div>
</section>
</section>
<section id="id10">
<h2>获取一对象<a class="headerlink" href="#id10" title="Permalink to this heading"></a></h2>
<p>要获取一对象，需发出带有 API 版本、帐户、容器和对象名的 <code class="docutils literal notranslate"><span class="pre">GET</span></code> 请求，而且必须有此容器的读权限，才能读取其内的对象。</p>
<section id="id11">
<h3>语法<a class="headerlink" href="#id11" title="Permalink to this heading"></a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">GET</span> <span class="o">/</span><span class="p">{</span><span class="n">api</span> <span class="n">version</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">account</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">container</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="nb">object</span><span class="p">}</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span>
<span class="n">Host</span><span class="p">:</span> <span class="p">{</span><span class="n">fqdn</span><span class="p">}</span>
<span class="n">X</span><span class="o">-</span><span class="n">Auth</span><span class="o">-</span><span class="n">Token</span><span class="p">:</span> <span class="p">{</span><span class="n">auth</span><span class="o">-</span><span class="n">token</span><span class="p">}</span>
</pre></div>
</div>
</section>
<section id="id12">
<h3>请求头<a class="headerlink" href="#id12" title="Permalink to this heading"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">range</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>要获取某一对象内容的一部分，你可以指定字节范围。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>日期（译者：应为整数？）</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>否</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">If-Modified-Since</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>如果从源对象的 <code class="docutils literal notranslate"><span class="pre">last_modified</span></code> 属性记录的时间起修改过，那就下载。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>日期</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>否</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">If-Unmodified-Since</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>如果从源对象的 <code class="docutils literal notranslate"><span class="pre">last_modified</span></code> 属性记录的时间起没有修改过，那就下载。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>日期</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>否</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">Copy-If-Match</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>请求中的 ETag 与源对象的 ETag 属性相同时才下载。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>ETag.</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>否</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">Copy-If-None-Match</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>请求中的 ETag 与源对象的 ETag 属性不同时才下载。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>ETag.</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>No</p>
</dd>
</dl>
</section>
<section id="id13">
<h3>响应头<a class="headerlink" href="#id13" title="Permalink to this heading"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">Content-Range</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>此区间表示对象内容的子集。只有在请求头中有 range 字段时才会返回此字段。</p>
</dd>
</dl>
</section>
</section>
<section id="id14">
<h2>获取对象元数据<a class="headerlink" href="#id14" title="Permalink to this heading"></a></h2>
<p>要查看一对象的元数据，可发送带有 API 版本、帐户、容器和对象名的 <code class="docutils literal notranslate"><span class="pre">HEAD</span></code> 头。你还必须有此容器的读权限才能其内对象的元数据。此请求会返回和获取对象本身时相同的头信息，只是不返回对象的数据而已。</p>
<section id="id15">
<h3>语法<a class="headerlink" href="#id15" title="Permalink to this heading"></a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">HEAD</span> <span class="o">/</span><span class="p">{</span><span class="n">api</span> <span class="n">version</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">account</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">container</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="nb">object</span><span class="p">}</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span>
<span class="n">Host</span><span class="p">:</span> <span class="p">{</span><span class="n">fqdn</span><span class="p">}</span>
<span class="n">X</span><span class="o">-</span><span class="n">Auth</span><span class="o">-</span><span class="n">Token</span><span class="p">:</span> <span class="p">{</span><span class="n">auth</span><span class="o">-</span><span class="n">token</span><span class="p">}</span>
</pre></div>
</div>
</section>
</section>
<section id="id16">
<h2>增加或更新对象元数据<a class="headerlink" href="#id16" title="Permalink to this heading"></a></h2>
<p>要给对象增加元数据需发送 <code class="docutils literal notranslate"><span class="pre">POST</span></code> 请求，要带上 API 版本、帐户、容器和对象名。你还必须有父容器的写权限才能增加或更新元数据。</p>
<section id="id17">
<h3>语法<a class="headerlink" href="#id17" title="Permalink to this heading"></a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">POST</span> <span class="o">/</span><span class="p">{</span><span class="n">api</span> <span class="n">version</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">account</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">container</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="nb">object</span><span class="p">}</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span>
<span class="n">Host</span><span class="p">:</span> <span class="p">{</span><span class="n">fqdn</span><span class="p">}</span>
<span class="n">X</span><span class="o">-</span><span class="n">Auth</span><span class="o">-</span><span class="n">Token</span><span class="p">:</span> <span class="p">{</span><span class="n">auth</span><span class="o">-</span><span class="n">token</span><span class="p">}</span>
</pre></div>
</div>
</section>
<section id="id18">
<h3>请求头<a class="headerlink" href="#id18" title="Permalink to this heading"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">X-Object-Meta-{key}</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>一个用户定义的元数据关键字，其值为任意字符串。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>字符串</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>否</p>
</dd>
</dl>
</section>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../containerops/" class="btn btn-neutral float-left" title="Container Operations" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../tempurl/" class="btn btn-neutral float-right" title="Temp URL 操作" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>